﻿#pragma once
/* 一次模拟称为一个 Run */

#include <chrono>

#include "G4Run.hh"
#include "G4UserRunAction.hh"  //一般用户自定义的RunAction类继承于此
//#include "G4Timer.hh"

class PrimaryGeneratorAction;
class RunAction : public G4UserRunAction
{
public:
    RunAction();
    ///声明每个Run开始时将被调用的函数：BeginOfRunAction(const G4Run*)
    void BeginOfRunAction(const G4Run*) override;

    ///声明每个Run结束时将被调用的函数：EndOfRunAction(const G4Run*)
    void EndOfRunAction(const G4Run*) override;

    using TimePoint = std::chrono::time_point<std::chrono::high_resolution_clock>;

private:
    TimePoint _seed0;
    TimePoint _seed1;

    //============================ primary generation
public:
    inline void SetPrimGenAction(PrimaryGeneratorAction* prim) { _primGen = prim; }
    inline PrimaryGeneratorAction* GetPrimGenAction() { return _primGen; }

private:
    PrimaryGeneratorAction* _primGen{};
};
